// 防抖函数

export const debounce = (fn, t) => {
  let timer
  const delay = t || 200
  return function () {
    const args = arguments
    const that = this
    // 清除上次延时器
    clearTimeout(timer)
    timer = setTimeout(function () {
      fn.apply(that, args)
    }, delay)
  }
}
